#include <iostream>
#include <vector> // 引入vector头文件
#define maxSize 100000

using namespace std;

int findMax(vector<int> &a, int &maxIndex) {
    int max = a[0];
    maxIndex = 0;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] > max) {
            max = a[i];
            maxIndex = i;
        }
    }
    return maxIndex;
}

int findMin(vector<int> &a, int &minIndex) {
    int min = a[0];
    minIndex = 0;
    for (int i = 0; i < a.size(); ++i) {
        if (a[i] < min) {
            min = a[i];
            minIndex = i;
        }
    }
    return minIndex;
}


int main() {
    int n; //n个评委
    double sum=0;
    scanf("%d", &n);
    vector<int> a(n); // 使用vector代替数组
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    int maxIndex, minIndex;
    maxIndex = findMax(a, maxIndex);
    minIndex = findMin(a, minIndex);
    for (int i = 0; i < n; ++i) {
        if (i==maxIndex || i== minIndex){
            sum=sum+0;
        }else{
            sum=sum+a[i];
        }
        return 0;
    }
    double avg=sum/(n-2); //平均数
    printf("%.2f",avg);
    return 0;
}
